package com.xueshishasha.oa.service.impl;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.xueshishasha.oa.model.Department;
import com.xueshishasha.oa.service.DataService;

public class DepartmentServiceImpl implements
		com.xueshishasha.oa.service.DepartmentService {
	
	private final Logger logger = LoggerFactory.getLogger(DepartmentServiceImpl.class);

	private DataService<Department> dataService ;

	

	
	@Override
	public Department getInfo(String id) {
		return this.getModelById(id);
	}


	@Override
	public void updateInfo(Department department) {
		this.update(department);
	}
	
	@Override
	public Serializable save(Department department){
		return dataService.save(department);
		
	}

	@Override
	public void delete(Department department) {
		dataService.delete(department);

	}

	@Override
	public List<Department> getAll() {
		String sql = "from Department";
		return dataService.getModels(sql,null);
	}

	@Override
	public Department getModelById(Serializable id) {
		return dataService.getModelById(Department.class, id);
	}

	@Override
	public List<Department> getModels(String hql, Object[] parameters) {
		return dataService.getModels(hql,parameters);
	}

	@Override
	public void saveOrUpdate(Department department) {
		dataService.saveOrUpdate(department);
	}

	@Override
	public void saveOrUpdateAll(Collection<Department> collection) {
		dataService.saveOrUpdateAll(collection);
	}

	@Override
	public void update(Department department) {
		dataService.update(department);
	}
	
	@Override
	public List<Department> getByCriteria(DetachedCriteria dc) {
		return dataService.getByCriteria(dc);
	}

	public DataService<Department> getDataService() {
		return dataService;
	}

	public void setDataService(DataService<Department> dataService) {
		this.dataService = dataService;
	}

	
}
